COM Error Handling

Each method of a wrapper object returns an HRESULT value. If the method call was successful, it returns S_OK; otherwise it returns a standard COM failure. If any of the methods calls return an HRESULT error code, the client can then call the GetLastError method to retrieve an error string, which is generally the actual IDL error message string.

The table below describes the error return values and their meaning when they are returned within the context of the wrapper method calls.

Error Code

Meaning

E_ACCESSDENIED

This error return value occurs in one of two situations:
  • IDL is busy. The client made a method call on a wrapper object, but the underlying IDL is still busy processing a previous request (method call) and has not finished yet. For more information, see IDL Ownership and Blocking.
  • The client called the Abort method on a wrapper object, but that wrapper object is not the current owner of the underlying IDL; therefore it is not allowed to abort IDL.

E_ABORT

This error return value occurs in one of two situations:

  • It is returned from the original wrapper method call whose operation was aborted by a successful call to the Abort method.
  • It occurs when the client has created several wrapper instances whose underlying IDL objects all live in the same IDL process. During a method call on one of those wrapper instances, the IDL pro code issues the IDL EXIT command. When this occurs, the OPS process is destroyed, which also destroys all the underlying IDL objects. However, the client needs to be notified of this event so that it can consider all those wrapper instances as invalid and not use them again. First, each listener (event subscriber) for each wrapper instances will receive an OnIDLNotify callback with the first string set to “OPS_NOTIFY_EXIT”. Then, the method call (if any) that is in progress at the time of the EXIT command will return with the specified error code.

Upon receiving the notification and after receiving this error code, the user must not make any other method calls on the wrapper instance, as the underlying IDL object no longer exits.

E_FAIL

This error return value occurs in one of two situations:

  • The client called the Abort method on a wrapper object, but the underlying IDL is not currently busy, so there is nothing to abort.
  • An IDL error occurred. In this case, the error message will be the same as the IDL error message.